Skip to main content

Get started

The Cosmograph widget allows users to visualize complex data relationships directly in Jupyter notebooks, enhancing data analysis capabilities. Built on top of Anywidget, it integrates seamlessly within Jupyter environments, providing an interactive graphing experience.

Installation

PyPI Version

To install the Cosmograph widget, run:

pip install cosmograph

Quick Start

After installation, you can import and use the widget in any Python-based notebook environment:

import pandas as pd
from cosmograph import cosmo

points = pd.DataFrame({
'id': [1, 2, 3, 4, 5],
'label': ['Node A', 'Node B', 'Node C', 'Node D', 'Node E'],
'value': [10, 20, 15, 25, 30],
'category': ['A', 'B', 'A', 'B', 'A']
})

links = pd.DataFrame({
'source': [1, 2, 3, 1, 2],
'target': [2, 3, 4, 5, 4],
'value': [1.0, 2.0, 1.5, 0.5, 1.8]
})

widget = cosmo(
points=points,
links=links,
point_id_by='id',
link_source_by='source',
link_target_by='target',
point_color_by='category',
point_include_columns=['value'],
point_label_by='label',
link_include_columns=['value'],
)
widget

The widget will render an interactive graph visualization inline, allowing you to explore and manipulate your data directly.

More Examples

🛸 Issues and Feedback

Submit issues to https://github.com/cosmograph-org/py_cosmograph/issues.

Questions? Contact us at
[email protected]